<?php

class Controller_Admin_Abstract extends Controller
{
	public function init()
	{
		$template = Agilet::getTemplate();

		$viewer = Agilet::getViewer();

		if ($viewer -> _id == null)
		{
			Agilet::redirect('user/signin', array('redirect_uri' => urlencode(Request::getCurrentUrl())));
			exit(0);
		}

		if ($viewer -> level_id > 2 || $viewer -> level_id < 1)
		{
			Agilet::redirect('restrict', array('redirect_uri' => urlencode(Request::getCurrentUrl())));
			exit(0);
		}

		$template -> name = 'admin';
		$template -> theme = 'admin';
	}

}
